package com.mworld.galaxy.bull.entity;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;

/**
 * 统一定义id的有状态entity基类
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时，不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */

@MappedSuperclass
@JsonAutoDetect(getterVisibility = Visibility.PUBLIC_ONLY)
public class StatefulIdEntity extends IdEntity {
    public static final int STATUS_ENABLED = 0;
    public static final int STATUS_DISABLED = 1;
    // NOTE: STATUS_DELETED must be bigger than any other status value.
    public static final int STATUS_DELETED = 10;

    protected int status;

    public StatefulIdEntity() {
    }

    public StatefulIdEntity(Long id) {
        super(id);
    }

    @Column(name = "c_status")
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

}
